package org.example.mytest.newMapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;
import org.example.mytest.newentity.goods;
import org.example.mytest.newentity.warehouse;

import java.util.List;

@Mapper
public interface GoodsMapper extends BaseMapper<goods> {
    @Select("SELECT g.GoodsID, g.WarehouseID, g.GoodsName, g.GoodsType,g.GoodsQuantity,g.GoodsWeight " +
            "FROM goods g")
    @Results({
            @Result(property = "goodsid", column = "GoodsID"),
            @Result(property = "warehouseid", column = "WarehouseID"),
            @Result(property = "goodsname", column = "GoodsName"),
            @Result(property = "goodstype", column = "GoodsType"),
            @Result(property = "goodsquantity", column = "GoodsQuantity"),
            @Result(property = "goodsweight", column = "GoodsWeight"),
            @Result(column = "warehouseid", property = "warehouse", javaType = warehouse.class,
                    one = @One(select = "org.example.mytest.newMapper.WarehouseMapper.findby"))
    })
    List<goods> getWarehouseAndGoodss();

}
